@echo off
if "%1"=="" goto usage

set ARCH=%1
if "%ARCH%"=="x64" set ARCH=amd64
if NOT "%ARCH%"=="x86" if NOT "%ARCH%"=="amd64" goto usage

echo Creating output dir
set OUTDIR=TestInstall_%ARCH%
rd %OUTDIR% /s /q
mkdir %OUTDIR%

echo Copy build output
set BUILDDIR=objchk_win7_%ARCH%\%ARCH%
xcopy "%BUILDDIR%\GenericSerialDriver.dll" %OUTDIR% 
xcopy "%BUILDDIR%\GenericSerialDriver.inf" %OUTDIR%

echo Copy co-installer DLL file
set REDISTDIR=c:\WinDDK\7600.16385.0\redist\wdf\%ARCH%
xcopy %REDISTDIR%\*.dll %OUTDIR%

echo Copy devcon.exe
if "%ARCH%"=="x86" set DEVCON="c:\WinDDK\7600.16385.0\tools\devcon\i386\devcon.exe"
if "%ARCH%"=="amd64" set DEVCON="c:\WinDDK\7600.16385.0\tools\devcon\amd64\devcon.exe"
xcopy %DEVCON% %OUTDIR%

echo Installing driver
%OUTDIR%\devcon install %OUTDIR%\GenericSerialDriver.inf "Sensors\GenericSerialDriver"

goto end

:usage
echo.
echo Usage: "install [x86|amd64]"
echo.

:end
